use std::os::raw::{c_ulonglong, c_void};

#[link(name = "xxh64", kind = "static")]
extern "C" {
    fn xxh64(input: *const c_void, length: usize, seed: c_ulonglong) -> c_ulonglong;
}

pub fn xxhash64(s: &[u8], seed: u64) -> u64 {
    unsafe { xxh64(s.as_ptr() as *const c_void, s.len(), seed) }
}

#[cfg(test)]
mod test {
    use crate::xxhash64;

    #[test]
    fn test() {
        assert_eq!(9313625240855019448, xxhash64(b"example data", 0));
    }
}
